<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head><title>Sending an email with JavaMail</title></h:head>
<h:body>
	<div style="text-align: center">
	<h1>Sending an Email with JavaMail</h1>
	<h3>Using a JAVA EE Web Application supporting <span style="color: red">JSF</span></h3>
    <h3><span style="color: red">Facelets</span> is the declaration language used</h3>
	</div>
	<hr />
	<div align="center" style="border-top-width: 50px">
		<h:form>
			<table>
			<tr>
				<th align="right">FROM:</th>
				<td><h:inputText id="from" value="#{emailJSFManagedBean.from}"
							validator="#{emailJSFManagedBean.validateEmail}" size="100"></h:inputText>
							<span style="margin-left:10px"><h:message
								for="from" style="color: #FF0000"></h:message></span></td>				 
			</tr>
			<tr>
				<th align="right">TO:</th>
				<td><h:inputText value="#{emailJSFManagedBean.to}" id="to"
							size="100" validator="#{emailJSFManagedBean.validateEmail}"></h:inputText>
							<span style="margin-left:10px"><h:message style="color:red" for="to"></h:message></span></td>
			</tr>
			<tr>
				<th align="right">SUBJECT:</th>
				<td><h:inputText value="#{emailJSFManagedBean.subject}" id="subject"
							size="100" validatorMessage="Subject is required">
							<f:validateRequired for="subject"></f:validateRequired></h:inputText>
							<span style="margin-left:10px"><h:message for="subject" style="color: #FF0000"></h:message>
							</span>
						</td>
			</tr>
			<tr bgcolor="#AAAAAA">
				<td colspan="2">
					<table align="right">
						<tr>
							<td>
							        smtp server
                                    <br></br>
                                    <h:inputText id="smtp"
										value="#{emailJSFManagedBean.smtp}" validatorMessage="SMTP IP address is required">
										<f:validateRequired for="smtp"></f:validateRequired>
									</h:inputText>
										<br></br>
										<span><h:message style="color:red" for="smtp"/></span>
								</td>
							<td>
							        username
                                    <br></br><h:inputText
										value="#{emailJSFManagedBean.username}" id="username"></h:inputText>
										<br></br>
										<span><h:message style="color:red" for="username"/></span>
								</td>
							<td>
							        password
                                    <br></br><h:inputSecret
										value="#{emailJSFManagedBean.password}" id="password"></h:inputSecret>
										<br></br>
										<span><h:message style="color:red" for="password"/></span>
								</td>
							<td>
							        port
                                    <br></br><h:inputText
										value="#{emailJSFManagedBean.port}" id="port" validatorMessage="Port is required">
										<f:validateRequired for="port"></f:validateRequired>
									</h:inputText>
										<br></br>
										<span><h:message style="color:red" for="port"/></span>
								</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
			 	<td colspan="2"><h:inputTextarea id="descr"
							value="#{emailJSFManagedBean.descr}" cols="100" rows="10"></h:inputTextarea></td>
			</tr>
            <tr>
                <td colspan="2" align="right"><h:commandButton
							id="submit" action="#{emailJSFManagedBean.submitEmail}"
							value="SEND EMAIL"></h:commandButton></td>
            </tr>
			</table>
		</h:form>
	</div>
</h:body>
</html>